package rpd.mapper;

import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import rpd.model.TbProvince;
import rpd.model.TbProvinceExample;
import rpd.model.TbProvinceKey;

public interface TbProvinceMapper {
    long countByExample(TbProvinceExample example);

    int deleteByExample(TbProvinceExample example);

    @Delete({
        "delete from tb_province",
        "where id = #{id,jdbcType=CHAR}"
    })
    int deleteByPrimaryKey(TbProvinceKey key);

    @Insert({
        "insert into tb_province (id, code, name, ",
        "father_code)",
        "values (#{id,jdbcType=CHAR}, #{code,jdbcType=INTEGER}, #{name,jdbcType=CHAR}, ",
        "#{fatherCode,jdbcType=INTEGER})"
    })
    int insert(TbProvince record);

    int insertSelective(TbProvince record);

    List<TbProvince> selectByExample(TbProvinceExample example);

    @Select({
        "select",
        "id, code, name, father_code",
        "from tb_province",
        "where id = #{id,jdbcType=CHAR}"
    })
    @ResultMap("rpd.mapper.TbProvinceMapper.BaseResultMap")
    TbProvince selectByPrimaryKey(TbProvinceKey key);

    int updateByExampleSelective(@Param("record") TbProvince record, @Param("example") TbProvinceExample example);

    int updateByExample(@Param("record") TbProvince record, @Param("example") TbProvinceExample example);

    int updateByPrimaryKeySelective(TbProvince record);

    @Update({
        "update tb_province",
        "set code = #{code,jdbcType=INTEGER},",
          "name = #{name,jdbcType=CHAR},",
          "father_code = #{fatherCode,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=CHAR}"
    })
    int updateByPrimaryKey(TbProvince record);
}